package com.dev.system.service.impl;

import java.util.List;
import com.dev.common.utils.DateUtils;
import com.dev.system.domain.SysRule;
import com.dev.system.mapper.SysRuleMapper;
import com.dev.system.service.ISysRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dev.common.core.text.Convert;

/**
 * 规则Service业务层处理
 * 
 * @author dev
 * @date 2019-09-19
 */
@Service
public class SysRuleServiceImpl implements ISysRuleService
{
    @Autowired
    private SysRuleMapper sysRuleMapper;

    /**
     * 查询规则
     * 
     * @param ruleId 规则ID
     * @return 规则
     */
    @Override
    public SysRule selectSysRuleById(Long ruleId)
    {
        return sysRuleMapper.selectSysRuleById(ruleId);
    }

    /**
     * 查询规则列表
     * 
     * @param sysRule 规则
     * @return 规则
     */
    @Override
    public List<SysRule> selectSysRuleList(SysRule sysRule)
    {
        return sysRuleMapper.selectSysRuleList(sysRule);
    }

    /**
     * 新增规则
     * 
     * @param sysRule 规则
     * @return 结果
     */
    @Override
    public int insertSysRule(SysRule sysRule)
    {
        sysRule.setCreateTime(DateUtils.getNowDate());
        return sysRuleMapper.insertSysRule(sysRule);
    }

    /**
     * 修改规则
     * 
     * @param sysRule 规则
     * @return 结果
     */
    @Override
    public int updateSysRule(SysRule sysRule)
    {
        sysRule.setUpdateTime(DateUtils.getNowDate());
        return sysRuleMapper.updateSysRule(sysRule);
    }

    /**
     * 删除规则对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysRuleByIds(String ids)
    {
        return sysRuleMapper.deleteSysRuleByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除规则信息
     * 
     * @param ruleId 规则ID
     * @return 结果
     */
    public int deleteSysRuleById(Long ruleId)
    {
        return sysRuleMapper.deleteSysRuleById(ruleId);
    }
}
